<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="../head.jsp"%>
<head>
	<title>德燊后台-登录</title>
</head>
<body>
<nav class="navbar navbar-default navbar-static-top">
	<div class="container">
		<div class="navbar-header">
	   		<%-- <a class="navbar-brand" href="${ctx}/sys/login">德燊</a> --%>
	 	</div>
	 	<div class="navbar-collapse collapse">
			<ul class="nav navbar-nav" id="navbar">
			   <li><a href="${ctx}/sys/main">德燊</a></li>
			</ul>
		</div>
	</div>
</nav>
<div class="" style="padding-top: 50px;">
	<form class="form-horizontal" role="form" id="loginForm" action="${ctx}/sys/loginCheck" method="POST">
		<div class="col-xs-offset-4 col-xs-3">
			<div class="form-group">
		    	<label class="col-xs-4 control-label">用户名</label>
		      	<div class="col-xs-6">
		         	<input type="text" name="username" maxlength="100"  class="form-control">
		      	</div>
		   	</div>
		   	<div class="form-group">
		      	<label class="col-xs-4 control-label">密码</label>
		      	<div class="col-xs-6">
		         	<input type="password" name="password" maxlength="16" class="form-control">
		      	</div>
		   	</div>
		   	<c:if test="${not empty login_error}">
			   	<div class="form-group">
			   		<div class="col-xs-offset-4 col-xs-6">
			   			<span style="color:red">${login_error}</span>
			   		</div>
			   	</div>
		   	</c:if>
			<div class="form-group">
		      <div class="col-xs-offset-4 col-xs-6">
		      	<input type="button" class="btn btn-info" id="login_btn" value="登录" />
		      </div>
			</div>
		</div>
	</form>
</div>
<script type="text/javascript">
	$(function(){
		$("#login_btn").on("click", function (){
			loginSubmit();
		});
		$("#loginForm").bind("keydown", function (e){
			if(e.keyCode == 13){
				loginSubmit();
			}
		});
	}); 
	
	/* 提交表单 */
	function loginSubmit(){
		var username = $("input[name='username']").val();
		if(username == ""){
			alert("请输入用户名");
			return ;
		}
		var password = $("input[name='password']").val();
		if(password == ""){
			alert("请输入密码");
			return ;
		}
		$("#loginForm").submit();
	}
	
	
</script>
</body>
</html>
